<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1 id="s">倒计时即将开始</h1>
<input type="text" placeholder="请输入倒计时的起始时间">
<button onclick="a()">点击开始倒计时</button>
<script>
  function a() {
    let h =document.getElementById("s");
    let i =document.querySelector("input")
    let num = i.value;
    let interval = setInterval(function () {
      h.innerText = num;
      num = num-1;
      if(num<0){
        clearInterval(interval);
        h.innerText = "倒计时结束";
      }
    },1000)
  }
</script>

</body>
</html>